﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HomeWork4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private int a = 0;
        private Timer myTimer = new Timer();
        private void StartCount(object sender, EventArgs e)
        {
            LableDisplay.Text = textBoxTime.Text;
            a = int.Parse(LableDisplay.Text);
            myTimer.Interval = 1000;
            myTimer.Tick += new EventHandler(Text_Tick);
            myTimer.Start();
        }
        private void Text_Tick(object obj,EventArgs e) {
            a--;
            LableDisplay.Text = a.ToString();
            if (a<=0)
            {
                myTimer.Enabled = false;
                label2.Text = "响铃";
            }
        }

    }
}
